package util.AST.Expressao;

import util.AST.Terminal.Valor;
import checker.SemanticException;
import checker.Visitor;

public class ExpressaoAriPrimaria extends ExpressaoAri {
	
    private String tipo;

	private Valor valor;
	private ExpressaoAri expAri;
	
	public ExpressaoAriPrimaria(Valor valor, ExpressaoAri expAri){
		this.valor = valor;
		this.expAri = expAri;
	}
	
	public Valor getValor(){
		return this.valor;
	}
	
	public ExpressaoAri getExpAri(){
		return this.expAri;
	}

	public String toString(int level) {
		int nextLevel = level+5;
		StringBuffer str = new StringBuffer();
		str.append("ExpAriPri\n");
		if ( this.valor != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.valor.toString(nextLevel));
		}
		else if ( this.expAri != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expAri.toString(nextLevel));
		
		}
		return str.toString();
	}
	
	public Object visit(Visitor v, Object o) throws SemanticException{
		return v.visitExpressaoAriPrimaria(this, o);		
	}
	
	public String getTipo() {
		return tipo;
	}

	public void setTipo(String tipo) {
		this.tipo = tipo;
	}

}
